﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Data;
using KimberlyDashboardLIB;


public class cGlobal : System.Web.UI.Page
{    

    #region "Declaraciones"
    public string cadenaConexion = ConfigurationManager.ConnectionStrings["CONEXION"].ToString();
    public KimberlyDashboardLIB.Seguridad objSeguridad = new KimberlyDashboardLIB.Seguridad();
    public KimberlyDashboardLIB.Dashboard objDashboard = new KimberlyDashboardLIB.Dashboard();    
    #endregion

    #region Propiedades

    public int idUsuario
    {
        get
        {
            if (Session["IDUSUARIO"] != null)
                return (int)Session["IDUSUARIO"];

            return 0;
        }
        set { Session["IDUSUARIO"] = value; }
    }

    public string nombreUsuario
    {
        get
        {
            if (Session["NOMBREUSUARIO"] != null)
                return (string)Session["NOMBREUSUARIO"];

            return null;
        }
        set { Session["NOMBREUSUARIO"] = value; }
    }

    public Usuario usuario
    {
        get
        {
            if (Session["USUARIO"] != null)
                return (Usuario)Session["USUARIO"];

            return null;
        }
        set { Session["USUARIO"] = value; }        
    }

    #endregion


    public Boolean DropDownFill(DropDownList ddl, DataTable dtt, string DataTextField, string DataValueField, string addItem, string valueItem)
    {
        ddl.DataSource = dtt.DefaultView;
        ddl.DataValueField = DataValueField;
        ddl.DataTextField = DataTextField;
        ddl.DataBind();
        ddl.Items.Insert(0, new ListItem(addItem, valueItem));        
        ddl.SelectedIndex = 0;
        return true;
    }


}

